package com.lzj.spring.mvc.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lzj.spring.mvcframework.annotation.LzjAutowrited;
import com.lzj.spring.mvcframework.annotation.LzjController;
import com.lzj.spring.mvcframework.annotation.LzjRequestMapping;
import com.lzj.spring.mvcframework.annotation.LzjRequestParam;
import com.lzj.spring.service.IDemoService;
/**
 * 手写Spring - SpringMvc
 * @author roseonly
 *
 */
@LzjController
@LzjRequestMapping("/demo")
public class DemoAction {

	@LzjAutowrited
	private IDemoService demoService;
	
	@LzjRequestMapping("/query.json")
	public void query(HttpServletRequest req, HttpServletResponse resp, @LzjRequestParam("name") String name) {
		String result = demoService.get(name);
		try {
			resp.getWriter().write(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
